﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Acms.Bll;
using Acms.DataControls;

public partial class UserControls_ArticleList : System.Web.UI.UserControl
{
    protected void Page_Load(object sender, EventArgs e)
    {
        dsPosts.SelectData += new EventHandler<Acms.DataControls.SelectEventArgs<Acms.Bll.Post>>(dsPosts_SelectData);
    }

    void dsPosts_SelectData(object sender, Acms.DataControls.SelectEventArgs<Acms.Bll.Post> e)
    {
        if(this.SelectData != null)
        {
            SelectData(sender, e);
        }
    }

    public event EventHandler<SelectEventArgs<Post>> SelectData;

    public string FeedName { get; set; }

    protected override object SaveViewState()
    {
        ViewState["FeedName"] = FeedName;
        return base.SaveViewState();
    }

    protected override void LoadViewState(object savedState)
    {
        base.LoadViewState(savedState);
        FeedName = ViewState["FeedName"] as string;
    }

    public int PageSize
    {
        get { return dlPosts.PageSize; }
        set { dlPosts.PageSize = value; }
    }

    public bool AllowPaging
    {
        get { return dlPosts.AllowPaging; }
        set { dlPosts.AllowPaging = value; }
    }

    public void Rebind()
    {
        dlPosts.DataBind();
    }
}
